<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Tolc: app/common/utils.php Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../tolc_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Tolc
   &#160;<span id="projectnumber">v 1.00</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>File&#160;List</span></a></li>
      <li><a href="../../globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d8/dfd/utils_8php_source.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">utils.php</div>  </div>
</div><!--header-->
<div class="contents">
<a href="../../d8/dfd/utils_8php.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;&lt;?php</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;</div>
<div class="line"><a name="l00013"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#af4a2ee0fcc1938603a0df8cb02e51fbd">   13</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#af4a2ee0fcc1938603a0df8cb02e51fbd">now</a>($str_user_timezone,</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;                         $str_server_timezone = <a class="code" href="../../d6/d75/init_8php.html#af848a01fa4e501e85d808d97709b2d46">CONST_SERVER_TIMEZONE</a>,</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;                         $str_server_dateformat = <a class="code" href="../../d6/d75/init_8php.html#a33e5075d3459f85a4eb4572cb019745f">CONST_SERVER_DATEFORMAT</a>) {</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;        <span class="comment">// set timezone to user timezone</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;        date_default_timezone_set($str_user_timezone);</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;        <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> = <span class="keyword">new</span> DateTime(<span class="stringliteral">&#39;now&#39;</span>);</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;        <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a>-&gt;setTimezone(<span class="keyword">new</span> DateTimeZone($str_server_timezone));</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        $str_server_now = <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a>-&gt;format($str_server_dateformat);</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;        <span class="comment">// return timezone to server default</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;        date_default_timezone_set($str_server_timezone);</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;        <span class="keywordflow">return</span> $str_server_now;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;}</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#a741e472b16682ea77137ca19054c17b8">   51</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#a741e472b16682ea77137ca19054c17b8">date_decode</a>($str_server_datetime,</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;                                         $str_user_timezone,</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;                                         $str_user_dateformat) {</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        <span class="comment">// create date object</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        <span class="keywordflow">try</span> {</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;                <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> = <span class="keyword">new</span> DateTime($str_server_datetime);</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        } <span class="keywordflow">catch</span>(Exception $e) {</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;                trigger_error(<span class="stringliteral">&#39;date_decode: Invalid datetime: &#39;</span> . $e-&gt;getMessage(), E_USER_ERROR);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        }</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        <span class="comment">// convert to user timezone</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        $userTimeZone = <span class="keyword">new</span> DateTimeZone($str_user_timezone);</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a>-&gt;setTimeZone($userTimeZone);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        <span class="comment">// convert to user dateformat</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;        $str_user_datetime = <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a>-&gt;format($str_user_dateformat);</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        <span class="keywordflow">return</span> $str_user_datetime;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;}</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#a06e96ccdcb8d9d23fdf1957d17276a72">  103</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#a06e96ccdcb8d9d23fdf1957d17276a72">date_encode</a>($str_user_datetime,</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;                                         $str_user_timezone,</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                                         $str_user_dateformat,</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                                         $str_server_timezone = <a class="code" href="../../d6/d75/init_8php.html#af848a01fa4e501e85d808d97709b2d46">CONST_SERVER_TIMEZONE</a>,</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                                         $str_server_dateformat = <a class="code" href="../../d6/d75/init_8php.html#a33e5075d3459f85a4eb4572cb019745f">CONST_SERVER_DATEFORMAT</a>,</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;                                         $str_safe_dateformat_strtotime = <a class="code" href="../../d6/d75/init_8php.html#a35f182c412b1dcc567444edf5954583f">CONST_SAFE_DATEFORMAT_STRTOTIME</a>) {</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        <span class="comment">// set timezone to user timezone</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        date_default_timezone_set($str_user_timezone);</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        <span class="comment">// create date object using any given format</span></div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        <span class="keywordflow">if</span>($str_user_datetime == <span class="stringliteral">&#39;now&#39;</span> || !$str_user_datetime) {</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;                <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> = <span class="keyword">new</span> DateTime(<span class="stringliteral">&#39;&#39;</span>, <span class="keyword">new</span> DateTimeZone($str_user_timezone));</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;                <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> = DateTime::createFromFormat($str_user_dateformat, $str_user_datetime, <span class="keyword">new</span> DateTimeZone($str_user_timezone));</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;                <span class="keywordflow">if</span>(<a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> === <span class="keyword">false</span>) {</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                        trigger_error(<span class="stringliteral">&#39;date_encode: Invalid date&#39;</span>, E_USER_ERROR);</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;                }</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;        }</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        <span class="comment">// convert given datetime to safe format for strtotime</span></div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        $str_user_datetime = <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a>-&gt;format($str_safe_dateformat_strtotime);</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        <span class="comment">// convert to UTC</span></div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        $str_server_datetime = gmdate($str_server_dateformat, strtotime($str_user_datetime));</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <span class="comment">// return timezone to server default</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        date_default_timezone_set($str_server_timezone);</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        <span class="keywordflow">return</span> $str_server_datetime;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;}</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#ab7f6c70b3d50bef108c5592f795c122e">  142</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#ab7f6c70b3d50bef108c5592f795c122e">get_time_offset</a>($str_datetime, $str_timezone) {</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        <a class="code" href="../../d2/d1b/ajax__regional_8php.html#af1cceca0f6633f202e2e3eccb72912af">$timezone</a> = <span class="keyword">new</span> DateTimeZone($str_timezone);</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        $offset = <a class="code" href="../../d2/d1b/ajax__regional_8php.html#af1cceca0f6633f202e2e3eccb72912af">$timezone</a>-&gt;getOffset(<span class="keyword">new</span> DateTime($str_datetime));</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        <span class="keywordflow">return</span> $offset;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;}</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;</div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#a81eae6dfa716bb01d32508a98d788343">  157</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#a81eae6dfa716bb01d32508a98d788343">mb_str_ireplace</a>($co, $naCo, $wCzym) {</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        $wCzymM = mb_strtolower($wCzym);</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;        $coM = mb_strtolower($co);</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        $offset = 0;</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        <span class="keywordflow">while</span>(!is_bool($poz = mb_strpos($wCzymM, $coM, $offset))) {</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;                $offset = $poz + mb_strlen($naCo);</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;                $wCzym = mb_substr($wCzym, 0, $poz) . $naCo . mb_substr($wCzym, $poz + mb_strlen($co));</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                $wCzymM = mb_strtolower($wCzym);</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        }</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        <span class="keywordflow">return</span> $wCzym;</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;}</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div>
<div class="line"><a name="l00177"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#ac8824e380dac56ae7d19339d11b5d4ef">  177</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#ac8824e380dac56ae7d19339d11b5d4ef">tz_list</a>() {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        $zones_array = array();</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;        $timestamp = time();</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        <span class="keywordflow">foreach</span>(timezone_identifiers_list() as $key =&gt; $zone) {</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;                date_default_timezone_set($zone);</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                $zones_array[$key][<span class="stringliteral">&#39;zone&#39;</span>] = $zone;</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                $zones_array[$key][<span class="stringliteral">&#39;diff_from_GMT&#39;</span>] = <span class="stringliteral">&#39;UTC/GMT &#39;</span> . date(<span class="charliteral">&#39;P&#39;</span>, $timestamp);</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;        }</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;        <span class="keywordflow">return</span> $zones_array;</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;}</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;</div>
<div class="line"><a name="l00195"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#a9da7b934dfa651fe1bbc33651076dab7">  195</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#a9da7b934dfa651fe1bbc33651076dab7">df_list</a>($a_df, $tz = <a class="code" href="../../d6/d75/init_8php.html#af848a01fa4e501e85d808d97709b2d46">CONST_SERVER_TIMEZONE</a>) {</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;        $df_array = array();</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;        $tz = <span class="keyword">new</span> DateTimeZone($tz);</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;        <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> = <span class="keyword">new</span> DateTime(<span class="stringliteral">&#39;&#39;</span>);</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;        <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a>-&gt;setTimeZone($tz);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;        <span class="keywordflow">foreach</span>($a_df as $df_key =&gt; $df_val) {</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;                $df = $df_val[<span class="stringliteral">&#39;php_datetime&#39;</span>];</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;                $df_example = <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a>-&gt;format($df);</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;                $df_array[$df_key] = array(<span class="stringliteral">&#39;dateformat&#39;</span> =&gt; $df, <span class="stringliteral">&#39;example&#39;</span> =&gt; $df_example);</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        }</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        <span class="keywordflow">return</span> $df_array;</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;}</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;</div>
<div class="line"><a name="l00220"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#ab5fc732d3ff0efbebfc32ac3cb5a5dd8">  220</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#ab5fc732d3ff0efbebfc32ac3cb5a5dd8">get_gravatar</a>(<a class="code" href="../../db/ded/ajax__user_8php.html#ad634f418b20382e2802f80532d76d3cd">$email</a>, $s = 80, $d = <span class="stringliteral">&#39;mm&#39;</span>, $r = <span class="charliteral">&#39;g&#39;</span>, $img = <span class="keyword">false</span>, $atts = array()) {</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = <span class="stringliteral">&#39;http://www.gravatar.com/avatar/&#39;</span>;</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> .= md5(strtolower(trim(<a class="code" href="../../db/ded/ajax__user_8php.html#ad634f418b20382e2802f80532d76d3cd">$email</a>)));</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> .= <span class="stringliteral">&quot;?s=$s&amp;d=$d&amp;r=$r&quot;</span>;</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;        <span class="keywordflow">if</span>($img) {</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;                <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = <span class="stringliteral">&#39;&lt;img src=&quot;&#39;</span> . <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> . <span class="charliteral">&#39;&quot;&#39;</span>;</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;                <span class="keywordflow">foreach</span>($atts as $key =&gt; $val)</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;                        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> .= <span class="charliteral">&#39; &#39;</span> . $key . <span class="stringliteral">&#39;=&quot;&#39;</span> . $val . <span class="charliteral">&#39;&quot;&#39;</span>;</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> .= <span class="stringliteral">&#39; /&gt;&#39;</span>;</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;        }</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>;</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;}</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;</div>
<div class="line"><a name="l00241"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#ab9c7f83caac87d29d267fcf9d9894560">  241</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#ab9c7f83caac87d29d267fcf9d9894560">get_gravatar_profile</a>(<a class="code" href="../../db/ded/ajax__user_8php.html#ad634f418b20382e2802f80532d76d3cd">$email</a>, $decode_url = <span class="keyword">false</span>) {</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;        $url_encoded = <span class="stringliteral">&#39;http://www.gravatar.com/&#39;</span> . md5(strtolower(trim(<a class="code" href="../../db/ded/ajax__user_8php.html#ad634f418b20382e2802f80532d76d3cd">$email</a>)));</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;        <span class="keywordflow">if</span>(!$decode_url) {</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;                <span class="keywordflow">return</span> $url_encoded;</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;        } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;                <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = $url_encoded . <span class="stringliteral">&#39;.php&#39;</span>;</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;                $str = file_get_contents(<a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>);</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;                <span class="keywordflow">if</span>($str === <span class="keyword">false</span>) {</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;                        <span class="keywordflow">return</span> $url_encoded;</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;                } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;                        $profile = unserialize($str);</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;                        <span class="keywordflow">if</span>(is_array($profile) &amp;&amp; isset($profile[<span class="stringliteral">&#39;entry&#39;</span>])) {</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;                                <span class="keywordflow">return</span> $profile[<span class="stringliteral">&#39;entry&#39;</span>][0][<span class="stringliteral">&#39;profileUrl&#39;</span>];</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;                        } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;                                <span class="keywordflow">return</span> $url_encoded;</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;                        }</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;                }</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;        }</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;}</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;</div>
<div class="line"><a name="l00267"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#a3cdfd9f7d63c5ea6dcb7508a7884ef84">  267</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#a3cdfd9f7d63c5ea6dcb7508a7884ef84">removeAccents</a>($str) {</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;        $a = array(<span class="stringliteral">&#39;À&#39;</span>, <span class="stringliteral">&#39;Á&#39;</span>, <span class="stringliteral">&#39;Â&#39;</span>, <span class="stringliteral">&#39;Ã&#39;</span>, <span class="stringliteral">&#39;Ä&#39;</span>, <span class="stringliteral">&#39;Å&#39;</span>, <span class="stringliteral">&#39;Æ&#39;</span>, <span class="stringliteral">&#39;Ç&#39;</span>, <span class="stringliteral">&#39;È&#39;</span>, <span class="stringliteral">&#39;É&#39;</span>, <span class="stringliteral">&#39;Ê&#39;</span>, <span class="stringliteral">&#39;Ë&#39;</span>, <span class="stringliteral">&#39;Ì&#39;</span>, <span class="stringliteral">&#39;Í&#39;</span>, <span class="stringliteral">&#39;Î&#39;</span>, <span class="stringliteral">&#39;Ï&#39;</span>, <span class="stringliteral">&#39;Ð&#39;</span>, <span class="stringliteral">&#39;Ñ&#39;</span>, <span class="stringliteral">&#39;Ò&#39;</span>, <span class="stringliteral">&#39;Ó&#39;</span>, <span class="stringliteral">&#39;Ô&#39;</span>, <span class="stringliteral">&#39;Õ&#39;</span>, <span class="stringliteral">&#39;Ö&#39;</span>, <span class="stringliteral">&#39;Ø&#39;</span>, <span class="stringliteral">&#39;Ù&#39;</span>, <span class="stringliteral">&#39;Ú&#39;</span>, <span class="stringliteral">&#39;Û&#39;</span>, <span class="stringliteral">&#39;Ü&#39;</span>, <span class="stringliteral">&#39;Ý&#39;</span>, <span class="stringliteral">&#39;ß&#39;</span>, <span class="stringliteral">&#39;à&#39;</span>, <span class="stringliteral">&#39;á&#39;</span>, <span class="stringliteral">&#39;â&#39;</span>, <span class="stringliteral">&#39;ã&#39;</span>, <span class="stringliteral">&#39;ä&#39;</span>, <span class="stringliteral">&#39;å&#39;</span>, <span class="stringliteral">&#39;æ&#39;</span>, <span class="stringliteral">&#39;ç&#39;</span>, <span class="stringliteral">&#39;è&#39;</span>, <span class="stringliteral">&#39;é&#39;</span>, <span class="stringliteral">&#39;ê&#39;</span>, <span class="stringliteral">&#39;ë&#39;</span>, <span class="stringliteral">&#39;ì&#39;</span>, <span class="stringliteral">&#39;í&#39;</span>, <span class="stringliteral">&#39;î&#39;</span>, <span class="stringliteral">&#39;ï&#39;</span>, <span class="stringliteral">&#39;ñ&#39;</span>, <span class="stringliteral">&#39;ò&#39;</span>, <span class="stringliteral">&#39;ó&#39;</span>, <span class="stringliteral">&#39;ô&#39;</span>, <span class="stringliteral">&#39;õ&#39;</span>, <span class="stringliteral">&#39;ö&#39;</span>, <span class="stringliteral">&#39;ø&#39;</span>, <span class="stringliteral">&#39;ù&#39;</span>, <span class="stringliteral">&#39;ú&#39;</span>, <span class="stringliteral">&#39;û&#39;</span>, <span class="stringliteral">&#39;ü&#39;</span>, <span class="stringliteral">&#39;ý&#39;</span>, <span class="stringliteral">&#39;ÿ&#39;</span>, <span class="stringliteral">&#39;Ā&#39;</span>, <span class="stringliteral">&#39;ā&#39;</span>, <span class="stringliteral">&#39;Ă&#39;</span>, <span class="stringliteral">&#39;ă&#39;</span>, <span class="stringliteral">&#39;Ą&#39;</span>, <span class="stringliteral">&#39;ą&#39;</span>, <span class="stringliteral">&#39;Ć&#39;</span>, <span class="stringliteral">&#39;ć&#39;</span>, <span class="stringliteral">&#39;Ĉ&#39;</span>, <span class="stringliteral">&#39;ĉ&#39;</span>, <span class="stringliteral">&#39;Ċ&#39;</span>, <span class="stringliteral">&#39;ċ&#39;</span>, <span class="stringliteral">&#39;Č&#39;</span>, <span class="stringliteral">&#39;č&#39;</span>, <span class="stringliteral">&#39;Ď&#39;</span>, <span class="stringliteral">&#39;ď&#39;</span>, <span class="stringliteral">&#39;Đ&#39;</span>, <span class="stringliteral">&#39;đ&#39;</span>, <span class="stringliteral">&#39;Ē&#39;</span>, <span class="stringliteral">&#39;ē&#39;</span>, <span class="stringliteral">&#39;Ĕ&#39;</span>, <span class="stringliteral">&#39;ĕ&#39;</span>, <span class="stringliteral">&#39;Ė&#39;</span>, <span class="stringliteral">&#39;ė&#39;</span>, <span class="stringliteral">&#39;Ę&#39;</span>, <span class="stringliteral">&#39;ę&#39;</span>, <span class="stringliteral">&#39;Ě&#39;</span>, <span class="stringliteral">&#39;ě&#39;</span>, <span class="stringliteral">&#39;Ĝ&#39;</span>, <span class="stringliteral">&#39;ĝ&#39;</span>, <span class="stringliteral">&#39;Ğ&#39;</span>, <span class="stringliteral">&#39;ğ&#39;</span>, <span class="stringliteral">&#39;Ġ&#39;</span>, <span class="stringliteral">&#39;ġ&#39;</span>, <span class="stringliteral">&#39;Ģ&#39;</span>, <span class="stringliteral">&#39;ģ&#39;</span>, <span class="stringliteral">&#39;Ĥ&#39;</span>, <span class="stringliteral">&#39;ĥ&#39;</span>, <span class="stringliteral">&#39;Ħ&#39;</span>, <span class="stringliteral">&#39;ħ&#39;</span>, <span class="stringliteral">&#39;Ĩ&#39;</span>, <span class="stringliteral">&#39;ĩ&#39;</span>, <span class="stringliteral">&#39;Ī&#39;</span>, <span class="stringliteral">&#39;ī&#39;</span>, <span class="stringliteral">&#39;Ĭ&#39;</span>, <span class="stringliteral">&#39;ĭ&#39;</span>, <span class="stringliteral">&#39;Į&#39;</span>, <span class="stringliteral">&#39;į&#39;</span>, <span class="stringliteral">&#39;İ&#39;</span>, <span class="stringliteral">&#39;ı&#39;</span>, <span class="stringliteral">&#39;Ĳ&#39;</span>, <span class="stringliteral">&#39;ĳ&#39;</span>, <span class="stringliteral">&#39;Ĵ&#39;</span>, <span class="stringliteral">&#39;ĵ&#39;</span>, <span class="stringliteral">&#39;Ķ&#39;</span>, <span class="stringliteral">&#39;ķ&#39;</span>, <span class="stringliteral">&#39;Ĺ&#39;</span>, <span class="stringliteral">&#39;ĺ&#39;</span>, <span class="stringliteral">&#39;Ļ&#39;</span>, <span class="stringliteral">&#39;ļ&#39;</span>, <span class="stringliteral">&#39;Ľ&#39;</span>, <span class="stringliteral">&#39;ľ&#39;</span>, <span class="stringliteral">&#39;Ŀ&#39;</span>, <span class="stringliteral">&#39;ŀ&#39;</span>, <span class="stringliteral">&#39;Ł&#39;</span>, <span class="stringliteral">&#39;ł&#39;</span>, <span class="stringliteral">&#39;Ń&#39;</span>, <span class="stringliteral">&#39;ń&#39;</span>, <span class="stringliteral">&#39;Ņ&#39;</span>, <span class="stringliteral">&#39;ņ&#39;</span>, <span class="stringliteral">&#39;Ň&#39;</span>, <span class="stringliteral">&#39;ň&#39;</span>, <span class="stringliteral">&#39;ŉ&#39;</span>, <span class="stringliteral">&#39;Ō&#39;</span>, <span class="stringliteral">&#39;ō&#39;</span>, <span class="stringliteral">&#39;Ŏ&#39;</span>, <span class="stringliteral">&#39;ŏ&#39;</span>, <span class="stringliteral">&#39;Ő&#39;</span>, <span class="stringliteral">&#39;ő&#39;</span>, <span class="stringliteral">&#39;Œ&#39;</span>, <span class="stringliteral">&#39;œ&#39;</span>, <span class="stringliteral">&#39;Ŕ&#39;</span>, <span class="stringliteral">&#39;ŕ&#39;</span>, <span class="stringliteral">&#39;Ŗ&#39;</span>, <span class="stringliteral">&#39;ŗ&#39;</span>, <span class="stringliteral">&#39;Ř&#39;</span>, <span class="stringliteral">&#39;ř&#39;</span>, <span class="stringliteral">&#39;Ś&#39;</span>, <span class="stringliteral">&#39;ś&#39;</span>, <span class="stringliteral">&#39;Ŝ&#39;</span>, <span class="stringliteral">&#39;ŝ&#39;</span>, <span class="stringliteral">&#39;Ş&#39;</span>, <span class="stringliteral">&#39;ş&#39;</span>, <span class="stringliteral">&#39;Š&#39;</span>, <span class="stringliteral">&#39;š&#39;</span>, <span class="stringliteral">&#39;Ţ&#39;</span>, <span class="stringliteral">&#39;ţ&#39;</span>, <span class="stringliteral">&#39;Ť&#39;</span>, <span class="stringliteral">&#39;ť&#39;</span>, <span class="stringliteral">&#39;Ŧ&#39;</span>, <span class="stringliteral">&#39;ŧ&#39;</span>, <span class="stringliteral">&#39;Ũ&#39;</span>, <span class="stringliteral">&#39;ũ&#39;</span>, <span class="stringliteral">&#39;Ū&#39;</span>, <span class="stringliteral">&#39;ū&#39;</span>, <span class="stringliteral">&#39;Ŭ&#39;</span>, <span class="stringliteral">&#39;ŭ&#39;</span>, <span class="stringliteral">&#39;Ů&#39;</span>, <span class="stringliteral">&#39;ů&#39;</span>, <span class="stringliteral">&#39;Ű&#39;</span>, <span class="stringliteral">&#39;ű&#39;</span>, <span class="stringliteral">&#39;Ų&#39;</span>, <span class="stringliteral">&#39;ų&#39;</span>, <span class="stringliteral">&#39;Ŵ&#39;</span>, <span class="stringliteral">&#39;ŵ&#39;</span>, <span class="stringliteral">&#39;Ŷ&#39;</span>, <span class="stringliteral">&#39;ŷ&#39;</span>, <span class="stringliteral">&#39;Ÿ&#39;</span>, <span class="stringliteral">&#39;Ź&#39;</span>, <span class="stringliteral">&#39;ź&#39;</span>, <span class="stringliteral">&#39;Ż&#39;</span>, <span class="stringliteral">&#39;ż&#39;</span>, <span class="stringliteral">&#39;Ž&#39;</span>, <span class="stringliteral">&#39;ž&#39;</span>, <span class="stringliteral">&#39;ſ&#39;</span>, <span class="stringliteral">&#39;ƒ&#39;</span>, <span class="stringliteral">&#39;Ơ&#39;</span>, <span class="stringliteral">&#39;ơ&#39;</span>, <span class="stringliteral">&#39;Ư&#39;</span>, <span class="stringliteral">&#39;ư&#39;</span>, <span class="stringliteral">&#39;Ǎ&#39;</span>, <span class="stringliteral">&#39;ǎ&#39;</span>, <span class="stringliteral">&#39;Ǐ&#39;</span>, <span class="stringliteral">&#39;ǐ&#39;</span>, <span class="stringliteral">&#39;Ǒ&#39;</span>, <span class="stringliteral">&#39;ǒ&#39;</span>, <span class="stringliteral">&#39;Ǔ&#39;</span>, <span class="stringliteral">&#39;ǔ&#39;</span>, <span class="stringliteral">&#39;Ǖ&#39;</span>, <span class="stringliteral">&#39;ǖ&#39;</span>, <span class="stringliteral">&#39;Ǘ&#39;</span>, <span class="stringliteral">&#39;ǘ&#39;</span>, <span class="stringliteral">&#39;Ǚ&#39;</span>, <span class="stringliteral">&#39;ǚ&#39;</span>, <span class="stringliteral">&#39;Ǜ&#39;</span>, <span class="stringliteral">&#39;ǜ&#39;</span>, <span class="stringliteral">&#39;Ǻ&#39;</span>, <span class="stringliteral">&#39;ǻ&#39;</span>, <span class="stringliteral">&#39;Ǽ&#39;</span>, <span class="stringliteral">&#39;ǽ&#39;</span>, <span class="stringliteral">&#39;Ǿ&#39;</span>, <span class="stringliteral">&#39;ǿ&#39;</span>, <span class="stringliteral">&#39;Ά&#39;</span>, <span class="stringliteral">&#39;ά&#39;</span>, <span class="stringliteral">&#39;Έ&#39;</span>, <span class="stringliteral">&#39;έ&#39;</span>, <span class="stringliteral">&#39;Ό&#39;</span>, <span class="stringliteral">&#39;ό&#39;</span>, <span class="stringliteral">&#39;Ώ&#39;</span>, <span class="stringliteral">&#39;ώ&#39;</span>, <span class="stringliteral">&#39;Ί&#39;</span>, <span class="stringliteral">&#39;ί&#39;</span>, <span class="stringliteral">&#39;ϊ&#39;</span>, <span class="stringliteral">&#39;ΐ&#39;</span>, <span class="stringliteral">&#39;Ύ&#39;</span>, <span class="stringliteral">&#39;ύ&#39;</span>, <span class="stringliteral">&#39;ϋ&#39;</span>, <span class="stringliteral">&#39;ΰ&#39;</span>, <span class="stringliteral">&#39;Ή&#39;</span>, <span class="stringliteral">&#39;ή&#39;</span>);</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;        $b = array(<span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="stringliteral">&#39;AE&#39;</span>, <span class="charliteral">&#39;C&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;D&#39;</span>, <span class="charliteral">&#39;N&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;Y&#39;</span>, <span class="charliteral">&#39;s&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="stringliteral">&#39;ae&#39;</span>, <span class="charliteral">&#39;c&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;n&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;y&#39;</span>, <span class="charliteral">&#39;y&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;C&#39;</span>, <span class="charliteral">&#39;c&#39;</span>, <span class="charliteral">&#39;C&#39;</span>, <span class="charliteral">&#39;c&#39;</span>, <span class="charliteral">&#39;C&#39;</span>, <span class="charliteral">&#39;c&#39;</span>, <span class="charliteral">&#39;C&#39;</span>, <span class="charliteral">&#39;c&#39;</span>, <span class="charliteral">&#39;D&#39;</span>, <span class="charliteral">&#39;d&#39;</span>, <span class="charliteral">&#39;D&#39;</span>, <span class="charliteral">&#39;d&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;E&#39;</span>, <span class="charliteral">&#39;e&#39;</span>, <span class="charliteral">&#39;G&#39;</span>, <span class="charliteral">&#39;g&#39;</span>, <span class="charliteral">&#39;G&#39;</span>, <span class="charliteral">&#39;g&#39;</span>, <span class="charliteral">&#39;G&#39;</span>, <span class="charliteral">&#39;g&#39;</span>, <span class="charliteral">&#39;G&#39;</span>, <span class="charliteral">&#39;g&#39;</span>, <span class="charliteral">&#39;H&#39;</span>, <span class="charliteral">&#39;h&#39;</span>, <span class="charliteral">&#39;H&#39;</span>, <span class="charliteral">&#39;h&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="stringliteral">&#39;IJ&#39;</span>, <span class="stringliteral">&#39;ij&#39;</span>, <span class="charliteral">&#39;J&#39;</span>, <span class="charliteral">&#39;j&#39;</span>, <span class="charliteral">&#39;K&#39;</span>, <span class="charliteral">&#39;k&#39;</span>, <span class="charliteral">&#39;L&#39;</span>, <span class="charliteral">&#39;l&#39;</span>, <span class="charliteral">&#39;L&#39;</span>, <span class="charliteral">&#39;l&#39;</span>, <span class="charliteral">&#39;L&#39;</span>, <span class="charliteral">&#39;l&#39;</span>, <span class="charliteral">&#39;L&#39;</span>, <span class="charliteral">&#39;l&#39;</span>, <span class="charliteral">&#39;l&#39;</span>, <span class="charliteral">&#39;l&#39;</span>, <span class="charliteral">&#39;N&#39;</span>, <span class="charliteral">&#39;n&#39;</span>, <span class="charliteral">&#39;N&#39;</span>, <span class="charliteral">&#39;n&#39;</span>, <span class="charliteral">&#39;N&#39;</span>, <span class="charliteral">&#39;n&#39;</span>, <span class="charliteral">&#39;n&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="stringliteral">&#39;OE&#39;</span>, <span class="stringliteral">&#39;oe&#39;</span>, <span class="charliteral">&#39;R&#39;</span>, <span class="charliteral">&#39;r&#39;</span>, <span class="charliteral">&#39;R&#39;</span>, <span class="charliteral">&#39;r&#39;</span>, <span class="charliteral">&#39;R&#39;</span>, <span class="charliteral">&#39;r&#39;</span>, <span class="charliteral">&#39;S&#39;</span>, <span class="charliteral">&#39;s&#39;</span>, <span class="charliteral">&#39;S&#39;</span>, <span class="charliteral">&#39;s&#39;</span>, <span class="charliteral">&#39;S&#39;</span>, <span class="charliteral">&#39;s&#39;</span>, <span class="charliteral">&#39;S&#39;</span>, <span class="charliteral">&#39;s&#39;</span>, <span class="charliteral">&#39;T&#39;</span>, <span class="charliteral">&#39;t&#39;</span>, <span class="charliteral">&#39;T&#39;</span>, <span class="charliteral">&#39;t&#39;</span>, <span class="charliteral">&#39;T&#39;</span>, <span class="charliteral">&#39;t&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;W&#39;</span>, <span class="charliteral">&#39;w&#39;</span>, <span class="charliteral">&#39;Y&#39;</span>, <span class="charliteral">&#39;y&#39;</span>, <span class="charliteral">&#39;Y&#39;</span>, <span class="charliteral">&#39;Z&#39;</span>, <span class="charliteral">&#39;z&#39;</span>, <span class="charliteral">&#39;Z&#39;</span>, <span class="charliteral">&#39;z&#39;</span>, <span class="charliteral">&#39;Z&#39;</span>, <span class="charliteral">&#39;z&#39;</span>, <span class="charliteral">&#39;s&#39;</span>, <span class="charliteral">&#39;f&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="charliteral">&#39;I&#39;</span>, <span class="charliteral">&#39;i&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;U&#39;</span>, <span class="charliteral">&#39;u&#39;</span>, <span class="charliteral">&#39;A&#39;</span>, <span class="charliteral">&#39;a&#39;</span>, <span class="stringliteral">&#39;AE&#39;</span>, <span class="stringliteral">&#39;ae&#39;</span>, <span class="charliteral">&#39;O&#39;</span>, <span class="charliteral">&#39;o&#39;</span>, <span class="stringliteral">&#39;Α&#39;</span>, <span class="stringliteral">&#39;α&#39;</span>, <span class="stringliteral">&#39;Ε&#39;</span>, <span class="stringliteral">&#39;ε&#39;</span>, <span class="stringliteral">&#39;Ο&#39;</span>, <span class="stringliteral">&#39;ο&#39;</span>, <span class="stringliteral">&#39;Ω&#39;</span>, <span class="stringliteral">&#39;ω&#39;</span>, <span class="stringliteral">&#39;Ι&#39;</span>, <span class="stringliteral">&#39;ι&#39;</span>, <span class="stringliteral">&#39;ι&#39;</span>, <span class="stringliteral">&#39;ι&#39;</span>, <span class="stringliteral">&#39;Υ&#39;</span>, <span class="stringliteral">&#39;υ&#39;</span>, <span class="stringliteral">&#39;υ&#39;</span>, <span class="stringliteral">&#39;υ&#39;</span>, <span class="stringliteral">&#39;Η&#39;</span>, <span class="stringliteral">&#39;η&#39;</span>);</div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;        <span class="keywordflow">return</span> str_replace($a, $b, $str);</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;}</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;</div>
<div class="line"><a name="l00281"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#adef31fd3c624e3d6eadcc5a15a682969">  281</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#adef31fd3c624e3d6eadcc5a15a682969">sanitize_url</a>(<a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>,</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;                                          <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#a8ef64a2308933589ceeeb75b95cb02b7">$url_length</a>,</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;                                          <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#a4051266b6103672dbb03140aec5e9994">$remove_accents</a> = <span class="keyword">true</span>,</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;                                          <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#a857d1c9b34992f955185d20c3241fd87">$convert_to_lower_case</a> = <span class="keyword">true</span>,</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;                                          <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#ad98f1b0945b0e29c316b69e1ff69db92">$replace_space_between_words_with_dash</a> = <span class="keyword">true</span>) {</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = trim(<a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>);</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = preg_replace(<span class="stringliteral">&#39;/\-+/&#39;</span>, <span class="charliteral">&#39;-&#39;</span>, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>); <span class="comment">//replace multiple dashes with one</span></div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = preg_replace(<span class="stringliteral">&#39;/\s+/&#39;</span>, <span class="charliteral">&#39; &#39;</span>, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>); <span class="comment">//replace multiple spaces with one</span></div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = preg_replace(<span class="stringliteral">&#39;/_+/&#39;</span>, <span class="charliteral">&#39;.&#39;</span>, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>); <span class="comment">//replace multiple underscore with one</span></div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = preg_replace(<span class="stringliteral">&#39;/\/+/&#39;</span>, <span class="charliteral">&#39;/&#39;</span>, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>); <span class="comment">//replace multiple slashes with one</span></div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = preg_replace(<span class="stringliteral">&#39;/\:+/&#39;</span>, <span class="charliteral">&#39;:&#39;</span>, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>); <span class="comment">//replace multiple colon with one</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = preg_replace(<span class="stringliteral">&#39;/\.+/&#39;</span>, <span class="charliteral">&#39;.&#39;</span>, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>); <span class="comment">//replace multiple dots with one</span></div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;</div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#a4051266b6103672dbb03140aec5e9994">$remove_accents</a> ? <a class="code" href="../../d8/dfd/utils_8php.html#a3cdfd9f7d63c5ea6dcb7508a7884ef84">removeAccents</a>(<a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>) : <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>; <span class="comment">// remove accented characters</span></div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#a857d1c9b34992f955185d20c3241fd87">$convert_to_lower_case</a> ? mb_strtolower(<a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>) : <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>; <span class="comment">// convert to lower case</span></div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#ad98f1b0945b0e29c316b69e1ff69db92">$replace_space_between_words_with_dash</a> ? preg_replace(<span class="stringliteral">&#39;/ /&#39;</span>, <span class="charliteral">&#39;-&#39;</span>, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>) : <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>; <span class="comment">//replace space between words with dash</span></div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;        <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a> = mb_substr(<a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>, 0, <a class="code" href="../../d0/d3d/ajax__new__page_8php.html#a8ef64a2308933589ceeeb75b95cb02b7">$url_length</a>); <span class="comment">// truncate to max length</span></div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>;</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;}</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;</div>
<div class="line"><a name="l00317"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#adc3d2aaaf8242b0db6211c72e955b7c8">  317</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#adc3d2aaaf8242b0db6211c72e955b7c8">valid_url</a>(<a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>, $str_regex, $str_regex_php_legacy) {</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;        <a class="code" href="../../db/d3f/ajax__addnew__page__version_8php.html#a49a8a4009b02e49717caa88b128affc5">$res</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;        <span class="keywordflow">if</span>(version_compare(phpversion(), <span class="stringliteral">&#39;5.3.10&#39;</span>, <span class="stringliteral">&#39;ge&#39;</span>)) {</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;                <a class="code" href="../../db/d3f/ajax__addnew__page__version_8php.html#a49a8a4009b02e49717caa88b128affc5">$res</a> = preg_match($str_regex, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>) ? <span class="keyword">false</span> : <span class="keyword">true</span>;</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;        } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;                <a class="code" href="../../db/d3f/ajax__addnew__page__version_8php.html#a49a8a4009b02e49717caa88b128affc5">$res</a> = preg_match($str_regex_php_legacy, <a class="code" href="../../db/ded/ajax__user_8php.html#acf215f34a917d014776ce684a9ee8909">$url</a>) ? <span class="keyword">false</span> : <span class="keyword">true</span>;</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;        }</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="../../db/d3f/ajax__addnew__page__version_8php.html#a49a8a4009b02e49717caa88b128affc5">$res</a>;</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;}</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;</div>
<div class="line"><a name="l00335"></a><span class="lineno"><a class="code" href="../../d8/dfd/utils_8php.html#aaafe5bfeb6c88ccc33990612b77a2199">  335</a></span>&#160;<span class="keyword">function</span> <a class="code" href="../../d8/dfd/utils_8php.html#aaafe5bfeb6c88ccc33990612b77a2199">isValidDateTimeString</a>($str_dt, $str_dateformat, $str_timezone) {</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        <a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> = DateTime::createFromFormat($str_dateformat, $str_dt, <span class="keyword">new</span> DateTimeZone($str_timezone));</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;        <span class="keywordflow">return</span> (<a class="code" href="../../d7/da6/ajax__datetime__range_8php.html#a481c918f8d853749e00b5942cabf599a">$date</a> === <span class="keyword">false</span> ? <span class="keyword">false</span> : <span class="keyword">true</span>);</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;}</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;?&gt;</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../dir_d422163b96683743ed3963d4aac17747.html">app</a></li><li class="navelem"><a class="el" href="../../dir_4a9513260508d5894bea9849c69369f8.html">common</a></li><li class="navelem"><a class="el" href="../../d8/dfd/utils_8php.html">utils.php</a></li>
    <li class="footer">Generated on Fri Aug 31 2012 22:06:31 for Tolc by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.2 </li>
  </ul>
</div>
</body>
</html>
